#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string str = "/numbers/1234";
    // 匹配以 /numbers/起始，后面跟一个或多个数字字符的字符串，并在匹配的过程中提取到这个匹配的数字字符串
    std::regex e("/numbers/(\\d+)");
    std::smatch matches;
    bool ret = std::regex_match(str, matches, e);//开始匹配
    if (ret == false)//匹配失败
    {
        return -1;
    }
    //匹配成功，提取字符串
    for (auto &s : matches)
    {
        std::cout << s << std::endl;
    }
    return 0;
}
